﻿<!DOCTYPE HTML>
<html lang="zh">
<head>
<title>StrLen - 语法 &amp; 使用 | AutoHotkey v2</title>
<meta name="description" content="The StrLen function retrieves the count of how many characters are in a string." />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
<script type="text/javascript">$(function(){0<=window.navigator.userAgent.toLowerCase().indexOf("ucbrowser")&&CaoNiMaDeUc()})</script>
</head>
<body>

<h1>StrLen</h1>
<p>检索字符串中的字符数.</p>
<pre class="Syntax">Length := <span class="func">StrLen</span>(String)</pre>

<h2 id="Parameters">参数</h2>
<dl>
  <dt>String</dt>
  <dd>
    <p>类型: <a href="../Concepts.htm#strings">字符串</a></p>
    <p>要统计其内容的字符串.</p>
  </dd>
</dl>

<h2 id="Return_Value">返回值</h2>
<p>类型: <a href="../Concepts.htm#numbers">整数</a></p>
<p>函数返回指定字符串的长度.</p>

<h2 id="Related">相关</h2>
<p><a href="InStr.htm">InStr</a>, <a href="SubStr.htm">SubStr</a>, <a href="Trim.htm">Trim</a>, <a href="StrLower.htm">StrLower</a>, <a href="StrLower.htm">StrUpper</a>, <a href="StrPut.htm">StrPut</a>, <a href="StrGet.htm">StrGet</a>, <a href="StrReplace.htm">StrReplace</a>, <a href="StrSplit.htm">StrSplit</a></p>
<h2 id="Examples">示例</h2>
<div class="ex" id="ExBasic">
<p><a class="ex_number" href="#ExBasic"></a> 获取和报告字符串中包含的字符数量.</p>
<pre>StrValue := "The quick brown fox jumps over the lazy dog"
MsgBox "The length of the string is " StrLen(StrValue) <em>; 结果: 43</em></pre>
</div>

</body>
</html>